﻿using KPIS.GERP.WEB.GIMS.Filters;
using WebMatrix.WebData;

namespace KPIS.GERP.WEB.GAMS.Classes
{
	[InitializeSimpleMembership]
	public static class GerpUsers 
	{
		public static int UserId()
		{
			Initialize();
			return WebSecurity.CurrentUserId;
		}

		public static bool IsInRoles(string roles)
		{
			Initialize();
			return true;
		}

		private static void Initialize()
		{
			if (!WebSecurity.Initialized)
			{
				WebSecurity.InitializeDatabaseConnection("GERPContext", "UserProfile", "UserId", "UserName", autoCreateTables: true);
			}
		}
	}
}